<template>
  <div>
    <h2><slot></slot></h2>

    <p>{{ myUserInfo }}</p>
    <p>{{ userInfo }}</p>
    <p>{{ userInfo2 }}</p>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'ModuleGetters2',
  computed: {
    // getters → 组件的 computed
    myUserInfo() {
      return this.$store.getters['userModule/userInfo']
    },

    // mapGetters
    ...mapGetters('userModule', ['userInfo']),

    // mapGetters 重命名
    ...mapGetters('userModule', {
      userInfo2: 'userInfo'
    })
  }
}
</script>
